<%@page import="com.pethub.controller.web.UserInfo"%>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib uri="http://www.rapid-framework.org.cn/rapid" prefix="rapid" %>
<rapid:override name="headContainer">

<div class="row navTop">
	<div class="col-lg-9 col-md-8 col-xs-0"></div>
	<div class="col-lg-3 col-md-4 col-xs-12">
		
		<div class="col-lg-3 col-md-3 col-xs-12 float-right no-padding">
			<button type="button" class="navBtn center" onclick="changeUrl('shop_home')">商店</button>
		</div>
		<div class="col-lg-3 col-md-3 col-xs-12 float-right	no-padding">
			<%
			UserInfo userInfo = null;
			try{
				if(session != null){
					userInfo = (UserInfo)session.getAttribute("user");
					
					if(userInfo != null){
						out.print("<button type='button' class='navBtn center'  onclick='changeUrl(\"home\")'>首页</button>");
					}
					else{
						out.print("<button type='button' class='navBtn center'  onclick='changeUrl(\"ph_login\")'>登录</button>");
					}
					
				}
			}
			catch (Exception e){
				out.print("null");
			}
			
			%>
			
		</div>
		<div class="col-lg-3 col-md-3 col-xs-12 float-right	no-padding displayNone"  id="logoff">
			<button type="button" class="navBtn center" onclick="changeUrl('log_off')">退出</button>
		</div>
		
		<div class="clearfix"></div>
		<div class="col-lg-4 col-md-4 col-xs-12  center no-padding displayNone" id="caretPanel" >
		    <div class=" float-right caretPanel">
		        <div class="center">
		        <%
					try{
						if(session != null){
							if(session.getAttribute("item")==null){
				        		out.print("没有商品");
				        	}
				        	else{
				        		out.print("您的商品为");
				        	}
						}
						else{
							out.print("没有商品");
						}
					}
					catch (Exception e){
						out.print("没有商品");
					}
		        	
		        %></div>
		        <div>
		        	<div class="center col-lg-6 col-md-6 col-xs-6 float-left" id="itemsNum">
		        	<%
					try{
						if(session != null){
							if(session.getAttribute("item")==null){
								out.print("0");
				        	}
				        	else{
				        		out.print(session.getAttribute("item"));
				        	}
						}
						else{
							out.print("0");
						}
					}
					catch (Exception e){
						out.print("0");
					}
		        	
		        %>
		        	个商品</div>
		        	<div class="center col-lg-6 col-md-6 col-xs-6 float-right" id="totalPrice">总价：
		        	<%
					try{
						if(session != null){
							if(session.getAttribute("price")==null){
								out.print("0");
				        	}
				        	else{
				        		out.print(session.getAttribute("price"));
				        	}
						}
						else{
							out.print("0");
						}
					}
					catch (Exception e){
						out.print("0");
					}
		        	
		        %></div>
		        	<div class="clearfix"></div>
		        </div>
		    </div>
		</div>
		<div class="clearfix"></div>
	</div>
</div>
</rapid:override>
<script type="text/javascript">
	function caretbtn(obj){
		console.log(obj)
		var cP=document.getElementById("caretPanel")
		if(window.innerWidth <=765){
			cP.style.position="relative";
			if(cP.className.indexOf("displayNone")>=0){
				cP.classList.remove("displayNone")
			}
			else{
				cP.classList.add("displayNone")
			}
		}
		else{
			cP.style.position="absolute";
			if(cP.className.indexOf("displayNone")>=0){
				cP.classList.remove("displayNone")
			}
			else{
				cP.classList.add("displayNone")
			}
		}
	}
	function changeUrl(obj){
		window.location.href = '/pethub/'+obj
	}
</script>